import React, { memo, useEffect, useState } from 'react'
import { FooterWrapper } from './style'
import { getRunTimer } from '@/utils/common'

export default memo(function B_Footer() {
  const [runTimer, setRunTimer] = useState('')

  useEffect(() => {
    const timer = setInterval(() => {
      setRunTimer(getRunTimer('2021-03-12 00:00:00'))
    }, 1000)
    return () => {
      clearInterval(timer)
    }
  }, [setRunTimer])

  return (
    <FooterWrapper>
      <div className="footer-img text-center">
        <img
          src="https://upload-images.jianshu.io/upload_images/20040970-68cd9cbbc6377230.png"
          alt=""
        />
      </div>
      <div className="footer-inner pt-5">
        <p>
          博客已萌萌哒运行{runTimer}
          <span className="face">٩(Ü)۶❤٩(Ü)۶接受小心心</span>
        </p>
        <p>Made with by JJJ.</p>
      </div>
    </FooterWrapper>
  )
})
